<%@page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="html" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<html:header title="首页">

    <link rel="stylesheet" href="${basePath}css/public.css" media="all">
    <script src="${baseUrl}js/myEchart.js" charset="utf-8"></script>

    <style type="text/css">
        .layui-card {border:1px solid #f2f2f2;border-radius:5px;}
        .panel {background-color:#fff;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}
        .panel-body {padding:10px}
        .panel-title {margin-top:0;margin-bottom:0;font-size:12px;color:inherit}
        .layui-bg-number {background-color:#F8F8F8;}

        .layui-bg-number:hover {cursor:pointer;background-color:#F2F2F2;}

        .layuimini-qiuck-module {text-align:center;border:1px solid #f2f2f2;}
        .layuimini-qiuck-module a i {display:inline-block;width:100%;height:60px;line-height:60px;text-align:center;border-radius:2px;font-size:30px;color:#333;transition:all .3s;-webkit-transition:all .3s;}
        .layuimini-qiuck-module a cite {position:relative;top:2px;display:block;color:#666;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:14px;}
    </style>

    <script>
        jQuery(function () {
            if (!isTrue(_businessSet.houseInOut)){
                $(".houseWaitIn,.houseWaitOut").hide();
            }

            get("${baseUrl}goodsCount/saleAnalysis/getTotalRatioData.action?day="+getDate(), function (res) {
                if (!emptyEntity(res.data)) {
                    let d = res.data;
                    $("#sale-profits").html(getPrice(d.profits));
                    if (parseFloat(d.profitsRatio) < 0) {
                        $("#profits-ratio").addClass("fontRed").html(getNumber(d.profitsRatio)+"%");
                    } else {
                        $("#profits-ratio").addClass("fontGreen").html("+"+getNumber(d.profitsRatio)+"%");
                    }

                    $("#sale-amt").html(getPrice(d.saleAmt));
                    if (parseFloat(d.amtRatio) < 0) {
                        $("#amt-ratio").addClass("fontRed").html(getNumber(d.amtRatio)+"%");
                    } else {
                        $("#amt-ratio").addClass("fontGreen").html("+"+getNumber(d.amtRatio)+"%");
                    }

                    $("#sale-num").html(getPrice(d.saleNum));
                    if (parseFloat(d.numRatio) < 0) {
                        $("#num-ratio").addClass("fontRed").html(getNumber(d.numRatio)+"%");
                    } else {
                        $("#num-ratio").addClass("fontGreen").html("+"+getNumber(d.numRatio)+"%");
                    }

                    $("#in-amt").html(getPrice(d.inAmt));
                    if (parseFloat(d.inRatio) < 0) {
                        $("#in-ratio").addClass("fontRed").html(getNumber(d.inRatio)+"%");
                    } else {
                        $("#in-ratio").addClass("fontGreen").html("+"+getNumber(d.inRatio)+"%");
                    }
                }
            });


            get("${baseUrl}welcome/data.action", function (res) {
                if (res.code == 1) {
                    $("#maxGoodsNumber").html(res.data.maxGoodsNumber);
                    $("#minGoodsNumber").html(res.data.minGoodsNumber);
                    $("#goodsNumber").html(res.data.goodsNumber);
                    $("#saleOrderNumber").html(res.data.saleOrderNumber);
                    $("#inGoodsOrderNumber").html(res.data.inGoodsOrderNumber);
                    $("#payWaitNumber").html(res.data.payWaitNumber);
                    $("#arrearsWaitNumber").html(res.data.arrearsWaitNumber);
                    $("#houseWaitOutNumber").html(res.data.houseWaitOutNumber);
                    $("#houseWaitInNumber").html(res.data.houseWaitInNumber);
                } else {
                    errTip(res.msg);
                }
            });
        });

        layui.use(['form', 'layedit','carousel', 'laydate','element','echarts',"miniTab"], function() {
            var form = layui.form
                , layer = layui.layer
                , carousel = layui.carousel
                , laydate = layui.laydate
                , echarts = layui.echarts
                , miniTab = layui.miniTab
                , element = layui.element;
            var carousel = layui.carousel;

            miniTab.listen();

            <shiro:hasPermission name="saleAnalysis:query">
            window.sale_trend_chat = echarts.init(document.getElementById('sale-trend'), 'walden');
            </shiro:hasPermission>

            <shiro:hasPermission name="company:insert">
            window.property_chat = echarts.init(document.getElementById('property-chat'), 'walden');
            </shiro:hasPermission>
            <shiro:hasPermission name="moneyWater:query">
            window.money_chat = echarts.init(document.getElementById('money-chat'), 'walden');
            </shiro:hasPermission>
            <shiro:hasPermission name="inGoodsAnalysis:query">
            window.inGoods_chat = echarts.init(document.getElementById('inGoods-chat'), 'walden');
            </shiro:hasPermission>
            <shiro:hasPermission name="houseQuery:query">
            window.house_amount_chat = echarts.init(document.getElementById('house-amount-chat'), 'walden');
            window.house_number_chat = echarts.init(document.getElementById('house-number-chat'), 'walden');
            </shiro:hasPermission>

            <shiro:hasPermission name="arrearsOrder:query">
            window.arrearsWait_chat = echarts.init(document.getElementById('arrearsWait-chat'), 'walden');
            </shiro:hasPermission>
            <shiro:hasPermission name="performanceAnalysis:query">
            window.performance_chat = echarts.init(document.getElementById('performance-chat'), 'walden');
            </shiro:hasPermission>

            window.onresize = function () {
                <shiro:hasPermission name="saleAnalysis:query">
                window.sale_trend_chat.resize();
                </shiro:hasPermission>
                <shiro:hasPermission name="company:insert">
                window.property_chat.resize();
                </shiro:hasPermission>
                <shiro:hasPermission name="moneyWater:query">
                window.money_chat.resize();
                </shiro:hasPermission>
                <shiro:hasPermission name="inGoodsAnalysis:query">
                window.inGoods_chat.resize();
                </shiro:hasPermission>
                <shiro:hasPermission name="houseQuery:query">
                window.house_amount_chat.resize();
                window.house_number_chat.resize();
                </shiro:hasPermission>
                <shiro:hasPermission name="arrearsOrder:query">
                window.arrearsWait_chat.resize();
                </shiro:hasPermission>
                <shiro:hasPermission name="performanceAnalysis:query">
                window.performance_chat.resize();
                </shiro:hasPermission>
            };


            <shiro:hasPermission name="saleAnalysis:query">
            get("${baseUrl}financeCount/operateAnalysis/getTrend.action?flag=day&day="+getDate(), function (res) {
                if (!emptyEntity(res.data)) {
                    $("#sale-trend").css("display","block");
                    $("#sale-trend").next().css("display","none");
                    window.sale_trend_chat.setOption(genNChatLineOption(res.data.labels, res.data.xData, res.data.series));
                }else {
                    $("#sale-trend").css("display","none");
                    $("#sale-trend").next().css("display","block");
                }
            });
            </shiro:hasPermission>


            <shiro:hasPermission name="company:insert">
            get("${baseUrl}funds/moneyWater/getProperty.action", function (res) {
                if (!emptyEntity(res.data)) {
                    window.property_chat.setOption(genPropertyOption(res.data));
                    $("#property").html(getPrice(res.data.total));
                } else {
                    $("#property-chat").css("display","none");
                    $("#property-chat").next().css("display","block");
                }
            });
            </shiro:hasPermission>

            <shiro:hasPermission name="moneyWater:query">
            get("${baseUrl}funds/moneyWater/getWeekTrend.action?day="+getDate(), function (res) {
                if (!emptyEntity(res.data)) {
                    window.money_chat.setOption(genNChatLineOption(res.data.labels, res.data.xData, res.data.series));
                } else {
                    $("#money-chat").css("display","none");
                    $("#money-chat").next().css("display","block");
                }
            });
            </shiro:hasPermission>


            <shiro:hasPermission name="inGoodsAnalysis:query">
            get("${baseUrl}goodsCount/inGoodsAnalysis/listWeekChatData.action?day="+getDate(), function (res) {
                if (!emptyList(res.data)) {
                    $("#inGoods-chat").css("display","block");
                    $("#inGoods-chat").next().css("display","none");
                    let names = [];
                    let datas = [];
                    for (let key in res.data) {
                        names.push(key);
                        datas.push(getPrice(res.data[key]));
                    }
                    window.inGoods_chat.setOption(genChatLineOption("进货额",names,datas));
                } else {
                    $("#inGoods-chat").css("display","none");
                    $("#inGoods-chat").next().css("display","block");
                }
            });
            </shiro:hasPermission>

            <shiro:hasPermission name="houseQuery:query">
            get("${baseUrl}goodsStock/getAmountOrderByHouse.action", function (res) {
                if (!emptyList(res.data)) {
                    window.house_amount_chat.setOption(genHouseQueryOption(true,res.data));
                } else {
                    $("#house-amount-chat").css("display","none");
                    $("#house-amount-chat").next().css("display","block");
                }
            });
            get("${baseUrl}goodsStock/getNumberOrderByHouse.action", function (res) {
                if (!emptyList(res.data)) {
                    window.house_number_chat.setOption(genHouseQueryOption(false,res.data));
                } else {
                    $("#house-number-chat").css("display","none");
                    $("#house-number-chat").next().css("display","block");
                }
            });
            </shiro:hasPermission>


            <shiro:hasPermission name="arrearsOrder:query">
            get("${baseUrl}funds/arrearsWait/getList.action?notNeedIn=true", function (res) {
                if (!emptyList(res.data)) {
                    window.arrearsWait_chat.setOption(genArrearsWaitOption(res.data));

                    let total=0;
                    $.each(res.data, function (i,d) {
                        total += parseFloat(d.waitIn)+parseFloat(d.init_amt);
                    });
                    $("#arrearsWaitTotal").html(getPrice(total));
                } else {
                    $("#arrearsWait-chat").css("display","none");
                    $("#arrearsWait-chat").next().css("display","block");
                }
            });
            </shiro:hasPermission>


            <shiro:hasPermission name="performanceAnalysis:query">
            let date = new Date();
            var endDate = laydate.getEndDate(date.getMonth()+1, date.getFullYear());
            let date1 = date.getFullYear()+"-"+preFillZero(date.getMonth() + 1, 2)+"01";
            let date2 = date.getFullYear()+"-"+preFillZero(date.getMonth() + 1, 2)+endDate;
            get("${baseUrl}financeCount/performanceAnalysis/listUserData.action?filterZero=true&date1="+date1+"&date2="+date2 , function (res) {
                if (!emptyList(res.data)) {
                    window.performance_chat.setOption(genPerformanceOption(res.data));
                } else {
                    $("#house-amount-chat").css("display","none");
                    $("#house-amount-chat").next().css("display","block");
                }
            });
            </shiro:hasPermission>
        });

        function openSaleAnalysis() {
            openTab("销售报表","${baseUrl}goodsCount/saleAnalysis.action?date1="+getDate()+"&date2="+getDate());
        }

        function openWeekSaleAnalysis() {
            openTab("销售报表","${baseUrl}goodsCount/saleAnalysis.action?date1="+getDateStr(-7)+"&date2="+getDate());
        }

        function openMoneyWater() {
            openTab("资金流水","${baseUrl}funds/moneyWater.action?date1="+getDate()+"&date2="+getDate());
        }
        function openWeekMoneyWater() {
            openTab("资金流水","${baseUrl}funds/moneyWater.action?date1="+getDateStr(-7)+"&date2="+getDate());
        }
        function openWeekInGoodsAnalysis() {
            openTab("进货报表","${baseUrl}goodsCount/inGoodsAnalysis.action?date1="+getDateStr(-7)+"&date2="+getDate());
        }
        function openHouseQuery() {
            openTab("库存查询","${baseUrl}house/houseQuery.action");
        }

        function openArrearsWait() {
            openTab("应收款","${baseUrl}funds/arrearsWait.action");
        }

        function openPayWait() {
            openTab("应付款","${baseUrl}funds/payWait.action");
        }

        function openGuide() {
            openTab("新手向导","${baseUrl}help/guide.action");
        }


        function openGoods() {
            openTab("商品列表","${baseUrl}goods/goods.action");
        }

        function openGoodsHouseWarn(type) {
            openTab("库存预警","${baseUrl}goods/goodsHouseWarn.action?type="+type);
        }

        function openSaleOrder() {
            openTab("销售订单","${baseUrl}sale/saleOrder.action");
        }

        function openInGoodsOrder() {
            openTab("进货订单","${baseUrl}inGoods/inGoodsOrder.action");
        }

        function openHouseIn() {
            openTab("入库","${baseUrl}house/houseInMain.action");
        }

        function openHouseOut() {
            openTab("入库","${baseUrl}house/houseOutMain.action");
        }

        function openPerformance() {
            layui.use(['laydate'], function() {
                var laydate = layui.laydate;
                let date = new Date();
                var endDate = laydate.getEndDate(date.getMonth()+1, date.getFullYear());
                let date1 = date.getFullYear()+"-"+preFillZero(date.getMonth() + 1, 2)+"01";
                let date2 = date.getFullYear()+"-"+preFillZero(date.getMonth() + 1, 2)+endDate;
                openTab("业绩报表","${baseUrl}financeCount/performanceAnalysis.action?date1="+date1+"&date2="+date2);
            });
        }


        function getDateStr (p_count) {
            var dd = new Date();
            dd.setDate(dd.getDate() + p_count);//获取p_count天后的日期
            var y = dd.getFullYear();
            var m = dd.getMonth() + 1;//获取当前月份的日期
            if( m <10){
                m = '0'+m;
            }
            var d = dd.getDate();
            if( d <10){
                d = '0'+d;
            }
            return y + "-" + m + "-" + d;
        }

        function genHouseQueryOption(flag, data) {
            let legendData=[];
            let seriesData = [];
            $.each(data, function (i,d) {
                let label;
                let value;
                if (flag) {
                    value = getPrice(d.amount);
                    label  = d.name + "(" + value + ")元";
                } else {
                    value = getNumber(d.number);
                    label  = d.name + "(" + value + ")";
                }
                legendData.push(label);
                seriesData.push({
                    name:label
                    ,value:value
                });
            });


            let option = {
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b}: {c} ({d}%)'
                },
                legend: {
                    orient: 'vertical',
                    left: 10,
                    data: legendData
                },
                series: [
                    {
                        name: '库存总额',
                        type: 'pie',
                        radius: ['50%', '70%'],
                        avoidLabelOverlap: false,
                        label: {
                            show: false,
                            position: 'center'
                        },

                        labelLine: {
                            show: false
                        },
                        data: seriesData
                    }
                ]
            };

            return option;
        }

        function genArrearsWaitOption(data) {
            let legendData=[];
            let seriesData = [];
            $.each(data, function (i,d) {
                let amount = getPrice(parseFloat(d.waitIn)+parseFloat(d.init_amt));
                let label = d.name + "(" + amount + ")元";
                legendData.push(label);
                seriesData.push({
                    name:label
                    ,value:getPrice(d.amount)
                });
            });


            let option = {
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b}: {c} ({d}%)'
                },
                legend: {
                    orient: 'vertical',
                    left: 10,
                    data: legendData
                },
                series: [
                    {
                        name: '欠款',
                        type: 'pie',
                        radius: ['50%', '70%'],
                        avoidLabelOverlap: false,
                        label: {
                            show: false,
                            position: 'center'
                        },

                        labelLine: {
                            show: false
                        },
                        data: seriesData
                    }
                ]
            };

            return option;
        }

        function genPropertyOption(data) {
            let legendData=[];
            let seriesData = [];

            let amount = getPrice(data.balance);
            let label = "账户余额("+amount+"元)";
            legendData.push(label);
            seriesData.push({
                name: label,
                value: amount
            });

            amount = getPrice(data.houseAmt);
            label = "库存总额("+amount+"元)";
            legendData.push(label);
            seriesData.push({
                name: label,
                value: amount
            });

            amount = getPrice(data.arrearsWait);
            label = "应收欠款("+amount+"元)";
            legendData.push(label);
            seriesData.push({
                name: label,
                value: amount
            });

            amount = getPrice(data.payWait);
            label = "应付欠款("+amount+"元)";
            legendData.push(label);
            seriesData.push({
                name: label,
                value: -amount
            });


            let option = {
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b}: {c} ({d}%)'
                },
                legend: {
                    orient: 'vertical',
                    left: 10,
                    data: legendData
                },
                series: [
                    {
                        name: '资产',
                        type: 'pie',
                        radius: ['50%', '70%'],
                        avoidLabelOverlap: false,
                        label: {
                            show: false,
                            position: 'center'
                        },

                        labelLine: {
                            show: false
                        },
                        data: seriesData
                    }
                ]
            };

            return option;
        }

        function genPerformanceOption(data) {
            let legendData=[];
            let seriesData = [];
            $.each(data, function (i,d) {
                let label = d.name + "(" + getPrice(d.amount) + ")元";
                legendData.push(label);
                seriesData.push({
                    name:label
                    ,value:getPrice(d.amount)
                });
            });


            let option = {
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b}: {c} ({d}%)'
                },
                legend: {
                    orient: 'vertical',
                    left: 10,
                    data: legendData
                },
                series: [
                    {
                        name: '业绩',
                        type: 'pie',
                        radius: ['50%', '70%'],
                        avoidLabelOverlap: false,
                        label: {
                            show: false,
                            position: 'center'
                        },

                        labelLine: {
                            show: false
                        },
                        data: seriesData
                    }
                ]
            };

            return option;
        }
    </script>

</html:header>
<body>
<div class="layuimini-container">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-xs12 layui-col-sm9 layui-col-md9 pd20 ">
            <shiro:hasPermission name="saleAnalysis:query">
            <div class="layui-card">
                <div class="layui-card-header">
                    <span>今日数据</span>
                </div>
                <div class="layui-card-body">
                    <div class="w100">
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-xs6 layui-col-sm3 layui-col-md3">
                                <div class="panel layui-bg-number" onclick="openSaleAnalysis();">
                                    <div class="panel-body">
                                        <div class="panel-title">
                                            <h5>今日销售毛利</h5>
                                        </div>
                                        <div class="panel-content">
                                            <span class="fontB fontDeepBlue font24" id="sale-profits">0</span>
                                            <span class="fontB font12" id="profits-ratio"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-xs6 layui-col-sm3 layui-col-md3">
                                <div class="panel layui-bg-number" onclick="openSaleAnalysis();">
                                    <div class="panel-body">
                                        <div class="panel-title">
                                            <h5>今日销售额</h5>
                                        </div>
                                        <div class="panel-content">
                                            <span class="fontB fontDeepBlue font24" id="sale-amt">0</span>
                                            <span class="fontB font12" id="amt-ratio"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-xs6 layui-col-sm3 layui-col-md3">
                                <div class="panel layui-bg-number" onclick="openSaleAnalysis();">
                                    <div class="panel-body">
                                        <div class="panel-title">
                                            <h5>今日销售额笔数</h5>
                                        </div>
                                        <div class="panel-content">
                                            <span class="fontB fontDeepBlue font24" id="sale-num">0</span>
                                            <span class="fontB font12" id="num-ratio"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-xs6 layui-col-sm3 layui-col-md3">
                                <div class="panel layui-bg-number" onclick="openMoneyWater();">
                                    <div class="panel-body">
                                        <div class="panel-title">
                                            <h5>今日资金入账</h5>
                                        </div>
                                        <div class="panel-content">
                                            <span class=" fontB fontDeepBlue font24" id="in-amt">0</span>
                                            <span class="fontB font12" id="in-ratio"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </shiro:hasPermission>


            <div class="layui-card">
                <div class="layui-card-header">快捷入口</div>
                <div class="layui-card-body">
                    <div class="welcome-module">
                        <div class="layui-row layui-col-space10 layuimini-qiuck">
                            <shiro:hasPermission name="sale:query">
                            <div class="layui-col-xs3 layuimini-qiuck-module">
                                <a href="javascript:;" layuimini-content-href="${baseUrl}sale/sale.action" data-title="销售" data-icon="fa fa-sign-in">
                                    <i class="fa fa-sign-in" style="color: #5FB878;"></i>
                                    <cite style="color: #5FB878;">销售</cite>
                                </a>
                            </div>
                            </shiro:hasPermission>

                            <shiro:hasPermission name="inGoods:query">
                            <div class="layui-col-xs3 layuimini-qiuck-module">
                                <a href="javascript:;" layuimini-content-href="${baseUrl}inGoods/inGoods.action" data-title="进货" data-icon="fa fa-plus-square">
                                    <i class="fa fa-plus-square" style="color: #5FB878;"></i>
                                    <cite style="color: #5FB878;">进货</cite>
                                </a>
                            </div>
                            </shiro:hasPermission>

                            <shiro:hasPermission name="houseQuery:query">
                            <div class="layui-col-xs3 layuimini-qiuck-module">
                                <a href="javascript:;" layuimini-content-href="${baseUrl}house/houseQuery.action" data-title="库存查询" data-icon="fa fa-search-plus">
                                    <i class="fa fa-search-plus" style="color: #5FB878;"></i>
                                    <cite style="color: #5FB878;">库存查询</cite>
                                </a>
                            </div>
                            </shiro:hasPermission>

                            <shiro:hasPermission name="goods:query">
                            <div class="layui-col-xs3 layuimini-qiuck-module">
                                <a href="javascript:;" layuimini-content-href="${baseUrl}goods/goods.action" data-title="商品" data-icon="fa fa-list">
                                    <i class="fa fa-list" style="color: #5FB878;"></i>
                                    <cite style="color: #5FB878;">商品</cite>
                                </a>
                            </div>
                            </shiro:hasPermission>

                            <shiro:hasPermission name="custom:query">
                            <div class="layui-col-xs3 layuimini-qiuck-module">
                                <a href="javascript:;" layuimini-content-href="${baseUrl}custom/custom.action" data-title="客户" data-icon="fa fa-address-card">
                                    <i class="fa fa-address-card" style="color: #01AAED;"></i>
                                    <cite style="color: #01AAED;">客户</cite>
                                </a>
                            </div>
                            </shiro:hasPermission>

                            <shiro:hasPermission name="provider:query">
                            <div class="layui-col-xs3 layuimini-qiuck-module">
                                <a href="javascript:;" layuimini-content-href="${baseUrl}provider/provider.action" data-title="供应商" data-icon="fa fa-handshake-o">
                                    <i class="fa fa-handshake-o" style="color: #01AAED;"></i>
                                    <cite style="color: #01AAED;">供应商</cite>
                                </a>
                            </div>
                            </shiro:hasPermission>

                            <shiro:hasPermission name="arrearsOrder:query">
                            <div class="layui-col-xs3 layuimini-qiuck-module">
                                <a href="javascript:;" layuimini-content-href="${baseUrl}funds/arrearsWait.action" data-title="应收款" data-icon="fa fa-arrows-h">
                                    <i class="fa fa-arrows-h" style="color: #01AAED;"></i>
                                    <cite style="color: #01AAED;">应收款</cite>
                                </a>
                            </div>
                            </shiro:hasPermission>

                            <shiro:hasPermission name="budget:query">
                            <div class="layui-col-xs3 layuimini-qiuck-module">
                                <a href="javascript:;" layuimini-content-href="${baseUrl}budget/budget.action" data-title="日常收支" data-icon="fa fa-money">
                                    <i class="fa fa-money" style="color: #01AAED;"></i>
                                    <cite style="color: #01AAED;">日常收支</cite>
                                </a>
                            </div>
                            </shiro:hasPermission>
                        </div>
                    </div>
                </div>
            </div>

            <shiro:hasPermission name="saleAnalysis:query">
            <div class="layui-card" >
                <div class="layui-card-header" style="cursor: pointer;" onclick="openWeekSaleAnalysis();">
                    销售走势
                </div>
                <div class="layui-card-body">
                    <div id="sale-trend" class="h200"></div>
                    <div class="h200 lh200 font20 fontB fontC_ccc" style="text-align: center;display: none;">
                        统计值为0或负数无法统计
                    </div>
                </div>
            </div>
            </shiro:hasPermission>

            <shiro:hasPermission name="company:insert">
            <div class="layui-card" >
                <div class="layui-card-header">
                    <div class="layui-row">
                        <div class="layui-col-xs6" style="text-align: left">
                            总资产
                        </div>
                        <div class="layui-col-xs6 pdr20" style="text-align: right">
                            <span class="font20 fontB" id="property">0.00</span>
                            <span>元</span>
                        </div>
                    </div>
                </div>
                <div class="layui-card-body h200">
                    <div id="property-chat" class="h200"></div>
                    <div class="h200 lh200 font20 fontB fontC_ccc" style="text-align: center;display: none;">
                        统计值为0或负数无法统计
                    </div>
                </div>
            </div>
            </shiro:hasPermission>

            <shiro:hasPermission name="arrearsOrder:query">
                <div class="layui-card" >
                    <div class="layui-card-header" style="cursor: pointer" onclick="openArrearsWait();">
                        <div class="layui-row">
                            <div class="layui-col-xs6" style="text-align: left">
                                客户欠款
                            </div>
                            <div class="layui-col-xs6 pdr20" style="text-align: right">
                                <span class="font20 fontB" id="arrearsWaitTotal">0.00</span>
                                <span>元</span>
                            </div>
                        </div>
                    </div>
                    <div class="layui-card-body">
                        <div id="arrearsWait-chat" class="h200"></div>
                        <div class="h200 lh200 font20 fontB fontC_ccc" style="text-align: center;display: none;">
                            统计值为0或负数无法统计
                        </div>
                    </div>
                </div>
            </shiro:hasPermission>


            <shiro:hasPermission name="moneyWater:query">
            <div class="layui-card" >
                <div class="layui-card-header" style="cursor: pointer;" onclick="openWeekMoneyWater();">
                    近7日现金流趋势
                </div>
                <div class="layui-card-body h200" >
                    <div id="money-chat" class="h200"></div>
                    <div class="h200 lh200 font20 fontB fontC_ccc" style="text-align: center;display: none;">
                        统计值为0或负数无法统计
                    </div>
                </div>
            </div>
            </shiro:hasPermission>

            <shiro:hasPermission name="houseQuery:query">
            <div class="layui-row" style="margin-bottom: 20px;">
                <div class="layui-col-xs12  layui-col-sm6 layui-col-md6 pdr4">
                    <div class="layui-card" >
                        <div class="layui-card-header" style="cursor: pointer" onclick="openHouseQuery();">库存分布-金额</div>
                        <div class="layui-card-body h200" >
                            <div style="background-color:#FFFFFF " >
                                <div id="house-amount-chat" class="h200"> </div>
                                <div class="h200 lh200 font20 fontB fontC_ccc" style="text-align: center;display: none;">
                                    统计值为0或负数无法统计
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-col-xs12 layui-col-sm6 layui-col-md6 pdr4">
                    <div class="layui-card" >
                        <div class="layui-card-header" style="cursor: pointer" onclick="openHouseQuery();">库存分布-数量</div>
                        <div class="layui-card-body h200" >
                            <div style="background-color:#FFFFFF " >
                                <div id="house-number-chat" class="h200"> </div>
                                <div class="h200 lh200 font20 fontB fontC_ccc" style="text-align: center;display: none;">
                                    统计值为0或负数无法统计
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </shiro:hasPermission>



            <shiro:hasPermission name="inGoodsAnalysis:query">
            <div class="layui-card" >
                <div class="layui-card-header" style="cursor: pointer" onclick="openWeekInGoodsAnalysis();">
                    近7日现进货趋势
                </div>
                <div class="layui-card-body h200">
                    <div id="inGoods-chat" class="h200"></div>
                    <div class="h200 lh200 font20 fontB fontC_ccc" style="text-align: center;display: none;">
                        统计值为0或负数无法统计
                    </div>
                </div>
            </div>
            </shiro:hasPermission>

            <shiro:hasPermission name="performanceAnalysis:query">
            <div class="layui-card" >
                <div class="layui-card-header" style="cursor: pointer" onclick="openPerformance();">
                    本月员工业绩
                </div>
                <div class="layui-card-body h200">
                    <div id="performance-chat" class="h200"></div>
                    <div class="h200 lh200 font20 fontB fontC_ccc" style="text-align: center;display: none;">
                        统计值为0或负数无法统计
                    </div>
                </div>
            </div>
            </shiro:hasPermission>
        </div>

        <div class="layui-col-xs12 layui-col-sm3 layui-col-md3 pd20">
            <div class="layui-card">
                <div class="layui-card-header">
                    <span>新手向导</span>
                </div>
                <div class="layui-card-body">
                    <span class="fontC999 font14">三个小步骤快速上手，经营效率提升30%</span><br>
                    <a class="layui-btn layui-btn-sm layui-btn-normal" onclick="openGuide();">即刻开始</a>
                </div>
            </div>


            <shiro:hasPermission name="goods:query">
            <div class="layui-card">
                <div class="layui-card-header">
                    <span>库存预警</span>
                </div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-xs12">
                            <div class="panel layui-bg-number" onclick="openGoods();">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <h5>全部商品</h5>
                                    </div>
                                    <div class="panel-content">
                                        <span class="fontB fontDeepBlue font24" id="goodsNumber">0</span>
                                        <span class="fontDeepBlue">种</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs6">
                            <div class="panel layui-bg-number" onclick="openGoodsHouseWarn(1)">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <h5>超储商品</h5>
                                    </div>
                                    <div class="panel-content">
                                        <span class="fontB fontDeepBlue font24" id="maxGoodsNumber">0</span>
                                        <span class="fontDeepBlue">种</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs6">
                            <div class="panel layui-bg-number" onclick="openGoodsHouseWarn(2)">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <h5>缺货商品</h5>
                                    </div>
                                    <div class="panel-content">
                                        <span class="fontB fontDeepBlue font24" id="minGoodsNumber">0</span>
                                        <span class="fontDeepBlue">种</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </shiro:hasPermission>

            <div class="layui-card">
                <div class="layui-card-header">
                    <div style="float: left;">老板寄语</div>
                    <div id="openNoticeDialogDiv" style="float: right;">
                        <a href="javascript:;">
                            <i id="openNoticeDialog" class="fa fa-edit font20"></i>
                        </a>
                        <script>
                            $("#openNoticeDialog").hide();
                            get("${baseUrl}user/getAdmin",function (res) {
                                if (res.code == 1 && res.data.id==_login_user.id){
                                    $("#openNoticeDialog").show();
                                }
                            });

                            get("${baseUrl}account/getNotice",function (res) {
                                if (res.code == 1 && !emptyEntity(res.data)){
                                    $("#notice").html(res.data);
                                }
                            });

                            $("#openNoticeDialog").click(function () {
                                prompt_textarea("老板寄语",function (index, value) {
                                    closeAll();
                                    if (emptyEntity(value)){
                                        return;
                                    }

                                    post("${baseUrl}account/updateNotice.action",{notice:value}, function (res) {
                                        if (res.code == 1) {
                                            $("#notice").html(value);
                                        }
                                    });
                                });
                            });
                        </script>
                    </div>
                </div>
                <div class="layui-card-body">
                    <span id="notice" class="fontC999 font14">写点什么告诉你的员工，为大家加油打气</span><br>
                </div>
            </div>

            <div class="layui-card">
                <div class="layui-card-header">
                    <span>待办事项</span>
                </div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space10">

                        <shiro:hasPermission name="saleOrder:query">
                        <div class="layui-col-xs6">
                            <div class="panel layui-bg-number" onclick="openSaleOrder();">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <h5>销售订单</h5>
                                    </div>
                                    <div class="panel-content">
                                        <span class="fontB fontDeepBlue font24" id="saleOrderNumber">0</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        </shiro:hasPermission>

                        <shiro:hasPermission name="inGoodsOrder:query">
                        <div class="layui-col-xs6">
                            <div class="panel layui-bg-number" onclick="openInGoodsOrder()">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <h5>进货订单</h5>
                                    </div>
                                    <div class="panel-content">
                                        <span class="fontB fontDeepBlue font24" id="inGoodsOrderNumber">0</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        </shiro:hasPermission>

                        <shiro:hasPermission name="arrearsOrder:query">
                        <div class="layui-col-xs6">
                            <div class="panel layui-bg-number" onclick="openArrearsWait()">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <h5>应收欠款</h5>
                                    </div>
                                    <div class="panel-content">
                                        <span class=" fontB fontDeepBlue font24" id="arrearsWaitNumber">0</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        </shiro:hasPermission>

                        <shiro:hasPermission name="payOrder:query">
                        <div class="layui-col-xs6">
                            <div class="panel layui-bg-number" onclick="openPayWait();">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <h5>应付欠款</h5>
                                    </div>
                                    <div class="panel-content">
                                        <span class=" fontB fontDeepBlue font24" id="payWaitNumber">0</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        </shiro:hasPermission>


                        <shiro:hasPermission name="houseOut:query">
                        <div class="layui-col-xs6 houseWaitIn">
                            <div class="panel layui-bg-number" onclick="openHouseOut()">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <h5>待出库</h5>
                                    </div>
                                    <div class="panel-content">
                                        <span class=" fontB fontDeepBlue font24" id="houseWaitOutNumber">0</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        </shiro:hasPermission>


                        <shiro:hasPermission name="houseIn:query">
                        <div class="layui-col-xs6 houseWaitOut">
                            <div class="panel layui-bg-number" onclick="openHouseIn()">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <h5>待入库</h5>
                                    </div>
                                    <div class="panel-content">
                                        <span class=" fontB fontDeepBlue font24" id="houseWaitInNumber">0</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        </shiro:hasPermission>
                    </div>
                </div>
            </div>

            <div class="layui-card">
                <div class="layui-card-header">
                    <span>联系作者</span>
                </div>
                <div class="layui-card-body">
                    <span class="fontC999 font14">
                        有使用上的问题和经验反馈可以联系本人。<br>
                        邮箱:723122704@qq.com<br>
                        后期如果需要qq群，本人会新建一个
                    </span>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
</html>